'''
Created on 9/04/2012

@author: Stefan Schliebs (sschliebs@gmail.com)
'''

import sys
#import futures

if sys.platform.startswith("linux"):
    from video_converter_linux import *
elif sys.platform.startswith("darwin"):
    from video_converter_osx import *
elif sys.platform.startswith("win"):
    from video_converter_windows import *
else:
    raise NotImplementedError()


if __name__ == "__main__":

    import sys
    
    if not len(sys.argv)==5:
        print "usage: %s <audio-dir> <img-dir> <tmp-dir> <output-file>" % sys.argv[0]
        sys.exit()
    
    # extract parameters
    prog, audio_dir, img_dir, tmp_dir, output_file = sys.argv
    
    # retrieve audio and image files
    audio_files = glob.glob(tmp_dir+"/audio/*.mp3")
    img_files = glob.glob(tmp_dir+"/images/*.png")
    
    # put them into the right order!
    audio_files.sort()
    img_files.sort()
    
    # start conversion
    converter = ConvertToVideo(img_files, audio_files, tmp_dir, output_file)
